<%--
  Created by IntelliJ IDEA.
  User: 杨璞
  Date: 2017/12/7
  Time: 13:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<html>
<head>
    <title>报表设置</title>
    <meta charset="UTF-8">
    <%--<meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />--%>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <%--<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">--%>
    <link rel="stylesheet" type="text/css" href="../../css/workflow/m_reset.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/workMonitor.css">
    <link rel="stylesheet" href="../../css/officialDocument/officialDocument.css">
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
    <link rel="stylesheet" type="text/css" href="/css/base/base.css?20201106.1" />
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/handle.css"/>
    <%--<link rel="stylesheet" type="text/css" href="../../css/workflow/work/bootstrap.css">--%>
    <script>

        function getCookie(name)
        {
            var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
            if(arr=document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return null;
        }

        var oHead = document.getElementsByTagName('HEAD').item(0);

        var oScript= document.createElement("script");
        var type = getCookie("language");
        oScript.type = "text/javascript";

        if(type){
            oScript.src="/js/Internationalization/"+type+".js";
        }else{
            oScript.src="/js/Internationalization/zh_CN.js";
        }
        oHead.appendChild( oScript);

    </script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="../../js/workflow/work/workform.js"></script>
    <script src="/js/workflow/reportSetting/reportSettingList.js"></script>
    <script src="../../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery/jquery.cookie.js"></script>

    <style>
        input{
            float:none;
            border:1px solid #ccc;
        }
        .workMon {
            font-size: 22px;
            font-weight: normal;
            line-height: 45px;
            float: none;
            margin-top: 9px;
            font-size: 22px;
            color: #333;
        }
        .flowNum, .artNum, #user {
            width: 100px;
        }



        .sms-bg-static{
            background: #d2d2d2 url("/img/images/sms-static.png") no-repeat left center;
        }
        .sms-bg-static.active{
            background: #3691da url(/img/images/sms.png) no-repeat left center;
        }
        .email-bg-static{
            background: #d2d2d2 url(/img/images/email-static.png) no-repeat left center;
        }
        .email-bg-static.active{
            background: #3691da url(/img/images/email.png) no-repeat left center;
        }
        .sms-check, .email-check, .mobile-check{
            width: 88px;
            height: 30px;
        }
        .userSelectBtn:hover {
            background: url(../../img/userSelectBtnhover.png) no-repeat -3px -2px;
        }
        .layui-layer-btn-{
            /*border-top: 1px solid #d6d6d6;*/
            /*background-color: #f6f6f6;*/
        }
        .prcsName h1 {
            text-align: center;
            line-height: 35px;
        }
        .layui-layer-page .layui-layer-content {
            overflow-x: hidden !important;
        }
        .layui-layer-title{
            color: #fff;
            font-size: 16px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            background:linear-gradient(to bottom,#2077c6,#2495df);
            FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0, startColorStr=#2077c6, endColorStr=#2495df);
            background: -ms-linear-gradient(top, #2077c6, #2495df);        /* IE 10 */
            background:-moz-linear-gradient(top, #2077c6, #2495df);/*火狐*/
            background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#2077c6), to(#2495df));  /* Safari 4-5, Chrome 1-9*/
            background: -webkit-linear-gradient(top, #2077c6, #2495df);   /*Safari5.1 Chrome 10+*/
            background: -o-linear-gradient(top, #2077c6, #2495df);  /*Opera 11.10+*/
        linear-gradient(to bottom, hsl(0, 80%, 70%), #2077c6); /* Standard syntax; must be last */
        }
        .xuanzhong1{
            left: 193px;
        }
        .work-prcs-title,.work-msg-title{
            background-color: #d6e7f8;
            color: #023964;
            font-size: 14px;
            position: relative;
        }
        .prcsName_chang{
            border: none;
            color:#fff;
            background: #3691da  url("../../../img/workflow/work/add_work/checked.png") no-repeat 20px center;
        }
        .user-tags{
            background: #fff;
        }
        .cytitle{
            position: absolute;
            left: 140px;
            font-size: 14px;
            color: #023964;
            top: 30px;
        }
        .feedbacktitle {
            position: relative;
            top: 3px;
            font-weight: bold;
            margin-left: 10px;
            color: #333333;
        }
        .feedbackcontent {
            margin-left: 23px;
            font-size: 15px;
            color: #333333;
        }
        .backinfo {
            width: 100%;
            height: 100px;
        }

        .sel{
            width:158px;
            max-height:250px;
            position: absolute;
            top:21px;
            left:64px;
            overflow: auto;
            background: #fff;
            border:1px solid #e2e3e3;
            display: none;
        }
        .sel li{
            line-height: 24px;
            color: #000;
        }
        #list{
            width:40px;
            height:30px;
            background: #f3f3f3;
            border:1px solid #ccc;
            vertical-align: middle;
            /*position: absolute;*/
            /*right: 0px;*/
            /*top: -8px;*/
            margin: -5px 0px 1px -40px;
            border-radius: 0px 3px 3px 0px;
        }
        #list img{
            margin-top: -2px;
            margin-left: 0px;
        }
        .canchoose:hover{
            background: #2b7edf;
            color: #fff;
            cursor: pointer;

        }
        input[name="flowName"],input[name="tableName"]{
            width:150px;
            height:28px;
            border-radius: 3px;
            margin-top: -6px;
        }
        #query:hover {
            background-color: #3b8eef !important;
            cursor: pointer;
        }
        #add {
            margin-left: 10px;
            color: #ffffff;
            cursor: pointer;
            border-radius: 4px;
            width: 100px;
            height: 26px;
            background-color: #0cae32 !important;
            border: 1px solid #0cae32;
        }
        #add:hover{
            background-color: #0cbf32 !important;
        }
        #outport:hover {
            background-color: #17bb3e !important;
            border: 1px solid #17bb3e !important;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
</head>
<body>
<div class="mainCon">
    <div class="header" style="background-color:white ">
        <div class="title">
            <img src="/img/commonTheme/${sessionScope.InterfaceModel}/gongzuojiankong.png" alt="" style="margin-bottom:10px;">
            <h3 style="display:inline;" class="workMon">报表设置</h3>
        </div>
    </div>
    <div class="section">
        <div class="selectNav" style="padding-top: 63px;padding-bottom: 13px">
            <%--<div style="position: relative">--%>
            <label style="position: relative;font-size: 10pt"><fmt:message code="workflow.th.processname"/>：
                <input type="text" name="flowName" placeholder="全部流程" dataType="" style="width: 150px;padding-left: 5px">
                <button id="list"><img src="../../img/workflow/work/xiala.png" alt=""></button>
                <ul class="sel"></ul>
            </label>

            <%--</div>--%>

            <%--<select name="flowId" id="flowName" style="width: 130px;">--%>
            <%--&lt;%&ndash;<option value=""><fmt:message code="workflow.th.wholeprocess"/></option>&ndash;%&gt;--%>
            <%--</select>--%>
            <label style="margin-left: 20px;font-size: 10pt">报表名称：</label>
            <input type="text" class="tableName" name="tableName" >
                <button id="query" style="margin-left: 20px;width: 80px;height: 26px;padding: 0px;">
                    <%--<img src="../../img/workflow/worksearch.png" style="margin-right: 2px;margin-left:5px;margin-bottom: 1px;">--%>
                    <%--<img src="../../img/workflow/worksearch1.png" style="margin-right: 2px;margin-left:5px;margin-bottom: 1px;">--%>
                        <span style="font-size: 10pt"><span style="margin-right: 5px;margin-left: -5px;"><img src="../../img/address/shape.png" style="width: 14px;height: 14px"></span><fmt:message code="global.lang.query"/></span>
                </button>
                <button id="add" style="margin-top: 5px;margin-left: 13px">
                    <span style="font-size: 10pt"><span style="font-size: 15pt;margin-right: 2px">+</span>新建报表</span>
                </button>

        </div>

    </div>

    <div id="pagediv">

    </div>
</div>
</body>
</html>
<script>
    var eventas;
    var pageObj=$.tablePage('#pagediv','1240px',[
        {
            width:'150px',
            title:'报表名称',
            name:'rName'
        },
        {
            width:'130px',
            title:'所属流程',
            name:'flowName',
//            selectFun:function (flowName,obj) {
//                return '<a class="wenhao" style="cursor: pointer;" onclick="jumpOpenType('+obj.flowId+',type=0)">'+flowName+'</a>';
//            }
        },
        {
            width:'125px',
            title:'创建人',
            name:'userName',
//            selectFun:function (runName,obj) {
//                return '<a class="wenhaoTwo" style="cursor: pointer;" flowId="'+ obj.flowId+'" runId="'+ obj.runId+'" prcsId="'+ obj.runId +'" onclick="jumpOpenName('+obj.flowId+','+obj.prcsId+','+obj.runId+','+obj.flowPrcs+')">'+runName+'</a>';
//            }
        },
        {
            width:'155px',
            title:'创建时间',
            name:'createDate',
//            selectFun:function (prcsName,obj) {
//                return '<a class="wenhao" style="cursor: pointer;" onclick="jumpOpenStep('+obj.flowId+','+obj.runId+',this)">'+prcsName+'</a>';
//            }
        },{
            width:'160px',
            title:'统计方式',
            name:'groupType',
            selectFun:function (groupType,obj) {
               if(groupType == 1){
                   return '列出详情'
               }else{
                   return '统计计算'
               }
            }
        },
        {
            width:'260px',
            title:'<fmt:message code="notice.th.operation"/>',
        }
    ],function (me){
        me.data.pageSize = 10;
        me.init('/reportSettings/queryReportSettings',[
            <%--{name:'<fmt:message code="workflow.th.Transfer"/>',fn:function(obj){--%>
            <%--return 1;--%>
            <%--}},--%>
            {name:'编辑',fn:function(obj){
                return 1;
            }},{name:'权限设置',fn:function(obj){
                return 1;
            }}, {name:'删除',fn:function(obj){
                return 1;
            }}])
    })

    $(document).click(function(){
        $('.sel').hide()
    })

    $('#list').click(function(e){
        e.stopPropagation()
        if( $('.sel').css('display')!='none'){
            $('.sel').hide()
        }else{
            $('.sel').show()
        }

    })
    $('#add').click(function(){
        window.open('/reportSettings/newReport')
    })


    $('[name="flowName"]').keyup(function(){
        $('.sel').show()
        var val=$(this).val()
        $('.sel li').each(function(i,v){
//            console.log(v.innerHTML)
            if(v.innerHTML.indexOf(val)>-1){
                $(v).show();
                $(v).parent().show()
            }else{
                $(v).hide();
            }
        })

    })

    $('.sel').on('click','li',function(e){
        e.stopPropagation()
        if($(this).attr('value')){
            $('[name="flowName"]').val($(this).html())
            $('[name="flowName"]').attr('dataType',$(this).attr('value'))
            $('.sel').hide()
        }else{
            $('.sel').show()
        }
    })

    function buildNode(len,data){
        var prefix = 10;
        for(var i=0;i<len;i++){
            prefix += 10;
        }

        $.each(data,function(i,item){
            if(0 < item.childs.length){
                $('.sel').append("<li style='padding-left:"+(prefix)+"px;font-weight:bold;font-size:14px;' id="+item.sortId +">" + item.sortName + "<li>");
                $.each(item.flowTypeModels,function(j,v){
                    $('.sel').append("<li style='padding-left:"+(prefix+10)+"px;cursor:pointer' class='canchoose' value="+v.flowId +">" +  v.flowName + "<li>");
                })
                buildNode(len+1,item.childs);
            }else{
                $('.sel').append("<li style='padding-left:"+(prefix)+"px;font-weight:bold;font-size:14px;' id="+item.sortId +">" + item.sortName + "<li>");
                $.each(item.flowTypeModels,function(j,v){
                    $('.sel').append("<li style='padding-left:"+(prefix+10)+"px;cursor:pointer' class='canchoose' value="+v.flowId +">" +  v.flowName + "<li>");
                })
            }
        });
    }

    $(function(){
        $.ajax({
            url:"/flow/selOneToAllType",
            type:'post',
            dataType:'json',
            success:function(res){
                var data=res.datas;
//                console.log(data)
                var str='<option value=""><fmt:message code="hr.th.PleaseSelect"/></option>';
                if(res.flag){
                    $.each(data,function(i,item){
                        $('.sel').append("<li class='ones' style='font-weight:bold;font-size:14px;' id="+item.sortId +"><img src='../../img/data_points.png' style='margin-right: 5px;    margin-top: 0px;' alt=''>" + item.sortName + "<li>");
                        $.each(item.flowTypeModels,function(j,v){
                            $('.sel').append("<li style='padding-left:10px;cursor:pointer' class='canchoose' value="+v.flowId +">" +v.flowName + "<li>");
//                                $('[name="dispatchType"]').append("<option value="+v.flowId +">" + + "</option>");
                        })
                        buildNode(1,item.childs);
                    });
                }
            }
        })
    })



</script>